import click
import re
from srsutil import *

@click.group()
def cli():
    pass


# 创建一个命令行组，读入一个md文件，输出一个excel文件
@cli.command()
@click.option('--output', '-o', default='', help='output file')
@click.option('--verbose', '-v', is_flag=True, help='verbose')
@click.argument('input', )
def srs(input, verbose, output):
    se = SEAst('srs')
    output = output or input+'.xlsx'
    ast, df = se.parse_file(input)
    if verbose:
        print(df)
    else:
        df.to_excel(output, index=False, encoding='utf-8', engine= 'xlsxwriter')

if __name__ == '__main__':
    cli()

